<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="DoMain.Food" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
 <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<title>updateFood</title>
</head>
<body>
<% 
		Object msg=request.getAttribute("message");
		if(msg!=null){	
	%>
	
	<font color="red"><%=msg %></font>
	
	<%	} %>
	
	<%	
	String foodNo=null;
	String oldName=null;
	String foodName=null;
	String foodDescription=null;
	String foodPrice=null;
	
	Food food=(Food)request.getAttribute("food");	
	
	if(food!=null){
		foodNo=food.getFoodNo()+"";
		foodName=food.getFoodName();
		oldName=food.getFoodName();
		foodDescription=food.getFoodDescription();
		foodPrice=food.getFoodPrice();
		
	%>
	
	<% }else{
		foodNo=request.getParameter("foodNo");
		oldName=request.getParameter("oldName");
		foodName=request.getParameter("oldName");
		foodDescription=request.getParameter("foodDescription");
		foodPrice=request.getParameter("foodPrice");
		
	}
	%>
	
	<form action="updateFood.do" method="post">
	
	<input type="hidden" name="foodNo" value="<%=foodNo%>">
	<input type="hidden" name="oldName" value="<%=oldName%>">	
	

	<div class="input-group">
    <span class="col-sm-2 col-form-label">菜品名称:</span>
    </div>
	<input type="text" name="foodName" value="<%=foodName%>">
	<div class="input-group">
    <span class="col-sm-2 col-form-label">菜品描述:</span>
    </div>
	<input type="text" name="foodDescription" value="<%=foodDescription%>">
	<div class="input-group">
    <span class="col-sm-2 col-form-label">菜品价格:</span>
    </div>
	<input type="text" name="foodPrice" value="<%=foodPrice%>">
	<div class="input-group">
    <button type="submit" class="btn btn-primary">Submit</button></div><br>
    <a class="" href="javascript:history.back(-1)">返回</a>
	</form>
</body>
</html>